ea9cbd0b01dd2811d7a63244dff492f89d0e5de4,yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepositoryTest.java,SharedSchemaRepositoryTest,testWithCacheRunning,#,257
Before Change
final SourceIdentifier runningId = RevisionSourceIdentifier.create("running", Optional.of("2012-12-12"));
sharedSchemaRepository.registerSchemaSource(new SchemaSourceProvider<YangTextSchemaSource>() {
@Override
public CheckedFuture<YangTextSchemaSource, SchemaSourceException> getSource(final SourceIdentifier sourceIdentifier) {
return Futures.immediateCheckedFuture(new YangTextSchemaSource(runningId) {
@Override
protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
return toStringHelper;
}
@Override
public InputStream openStream() throws IOException {
return new ByteArrayInputStream("running".getBytes(StandardCharsets.UTF_8));
}
});
}
}, PotentialSchemaSource.create(runningId, YangTextSchemaSource.class, PotentialSchemaSource.Costs.REMOTE_IO.getValue()));
final TextToASTTransformer transformer = TextToASTTransformer.create(sharedSchemaRepository, sharedSchemaRepository);
sharedSchemaRepository.registerSchemaSourceListener(transformer);
After Change
final SourceIdentifier runningId = RevisionSourceIdentifier.create("running", Optional.of("2012-12-12"));
sharedSchemaRepository.registerSchemaSource(sourceIdentifier -> Futures.immediateCheckedFuture(
new YangTextSchemaSource(runningId) {
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
return toStringHelper;
}
@Override
public InputStream openStream() throws IOException {
return new ByteArrayInputStream("running".getBytes(StandardCharsets.UTF_8));
}
}), PotentialSchemaSource.create(runningId, YangTextSchemaSource.class,
PotentialSchemaSource.Costs.REMOTE_IO.getValue()));
final TextToASTTransformer transformer = TextToASTTransformer.create(sharedSchemaRepository,
sharedSchemaRepository);